<?php
class xml extends CI_Controller{
	
	function __construct()
	{
		parent::__construct();
	}
	
	function read()
	{
		$file = "file/employees.xml";
		$doc = new DOMDocument();
		$doc->load($file);
		$employees = $doc->getElementsByTagName("employee");
		$tmp = array();
		foreach($employees as $employee){
			$names = $employee->getElementsByTagName("name");
			$name = $names->item(0)->nodeValue;
			
			$ages= $employee->getElementsByTagName( "age" );
			$age= $ages->item(0)->nodeValue;
			 
			$salaries = $employee->getElementsByTagName( "salary" );
			$salary = $salaries->item(0)->nodeValue;
			$tmp[] = array("name" => $name, "age" => $age, "salary" => $salary);
		}
		
		print_r($tmp);
	}
}